package com.crois.barrier.admin.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.crois.barrier.admin.entity.IpAndWeight;
import com.crois.barrier.admin.mapper.IpAndWeightMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * barrier 实例信息表
 * @author Hou Ze Yu
 * @date 2021-10-25 11:58:26
 */
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class IpAndWeightSvc extends ServiceImpl<IpAndWeightMapper,IpAndWeight> implements IIpAndWeightSvc {

    @Override
    public List<IpAndWeight> getIpAndWeightListByRouteId(Integer routeInfoId) {
        QueryWrapper<IpAndWeight> ipAndWeightQueryWrapper = new QueryWrapper<>();
        ipAndWeightQueryWrapper.lambda().eq(IpAndWeight::getApiRouteId,routeInfoId);
        return baseMapper.selectList(ipAndWeightQueryWrapper);
    }
}
